package edu.sctu.zhengsenwen.month201506.day20150623.operator;

/**
 *
 * 赋值操作符
 * Created by user15 on 2015/6/23.
 */
public class EvalueteOperatorDemo {

    public EvalueteOperatorDemo(){

        int number = 5;
        System.out.println("number = "+number);
        System.out.println("number += 5,number = "+String.valueOf(number += 5));

        number = 5;
        System.out.println("number -= 5,number = "+String.valueOf(number -= 5));

        number = 5;
        System.out.println("number *= 5,number = "+String.valueOf(number *= 5));

        number = 5;
        System.out.println("number /= 5,number = "+String.valueOf(number /= 5));

        number = 5;
        System.out.println("number %= 5,number = "+String.valueOf(number %= 5));

        number = 5;
        System.out.println("number &= 5,number = "+String.valueOf(number &= 5));

        number = 5;
        System.out.println("number |= 5,number = "+String.valueOf(number |= 5));

        //按位异或赋值
        number = 5;
        System.out.println("number ^= 5,number = "+String.valueOf(number ^= 5));

        //a<<=n就是a乘以2的n次方
        number = 5;
        System.out.println("number <<= 5,number = "+String.valueOf(number <<= 5));


        //按位右移
        number = 5;
        System.out.println("number >>= 5,number = "+String.valueOf(number >>= 5));

        //按位右移，最高位用0填充
        number = 5;
        System.out.println("number >>>= 5,number = "+String.valueOf(number >>>= 5));
    }

    public static void main(String[] args) {

        new EvalueteOperatorDemo();
    }
}













